%% 从文本文件中导入数据
% 用于从以下文本文件中导入数据的脚本:
%
%    filename: D:\ScientificResearch\2025-03-27-PVGPU\CPU\data_PVunit2.csv
%
% 由 MATLAB 于 2025-04-02 17:14:42 自动生成

%% 设置导入选项并导入数据
clear all;
opts = delimitedTextImportOptions("NumVariables", 16);

% 指定范围和分隔符
opts.DataLines = [2, Inf];
opts.Delimiter = ",";

% 指定列名称和类型
opts.VariableNames = ["Time", "VpvBus", "Ipv", "VdcBus", "Pcon1", "Qcon1", "VacRMS", "Pcon1filt", "Qcon1filt", "VacRMSfilt", "Vcon1A", "Vcon1B", "Vcon1C", "Icon1A", "Icon1B", "Icon1C"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];

% 指定文件级属性
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";

% 导入数据
tbl = readtable("D:\ScientificResearch\2025-03-27-PVGPU\CPU\data_PVunit2.csv", opts);

%% 转换为输出类型
Time = tbl.Time;
VpvBus = tbl.VpvBus;
Ipv = tbl.Ipv;
VdcBus = tbl.VdcBus;
Pcon1 = tbl.Pcon1;
Qcon1 = tbl.Qcon1;
VacRMS = tbl.VacRMS;
Pcon1filt = tbl.Pcon1filt;
Qcon1filt = tbl.Qcon1filt;
VacRMSfilt = tbl.VacRMSfilt;
Vcon1A = tbl.Vcon1A;
Vcon1B = tbl.Vcon1B;
Vcon1C = tbl.Vcon1C;
Icon1A = tbl.Icon1A;
Icon1B = tbl.Icon1B;
Icon1C = tbl.Icon1C;

plot(Time, Pcon1filt)

%% 清除临时变量
clear opts tbl